Created from anat_archi_summary_v1.Rmd
#####Getting image dimensions####
# list JPG files in a directory
square_files <- list.files(path = "square", pattern = "\\.jpg$", full.names = TRUE)
get_image_dimensions <- function(image_path) {
img <- readJPEG(image_path, native = TRUE) # Load the image
list(
file = basename(image_path), # File name
width_px = attr(img, "dim")[2], # Width
height_px = attr(img, "dim")[1] # Height
)
}
#function to all images
image_dimensions <- lapply(square_files, get_image_dimensions)
#get data frame
image_dimensions_df <- do.call(rbind.data.frame, image_dimensions)
#####Making variables in good format####
image_dimensions_df$id_complete <- gsub("_square\\.jpg$", "", image_dimensions_df$file)
image_dimensions_df$id_amap <- substr(image_dimensions_df$id_complete, 1, 4)
image_dimensions_df$id_complete2 <- ifelse(
nchar(image_dimensions_df$id_complete) == 28,
paste0(substr(image_dimensions_df$id_complete, 1, 12), "0", substr(image_dimensions_df$id_complete, 13, nchar(image_dimensions_df$id_complete))),
image_dimensions_df$id_complete
)
image_dimensions_df$id_complete3 <- ifelse(
nchar(image_dimensions_df$id_complete2) == 30,
paste0(substr(image_dimensions_df$id_complete2, 1, 12), "0", substr(image_dimensions_df$id_complete2, 13, nchar(image_dimensions_df$id_complete2))),
image_dimensions_df$id_complete2
)
image_dimensions_df$id_complete4 <- gsub("Tige", "T", image_dimensions_df$id_complete3)
image_dimensions_df$id_complete5 <- gsub("Racine", "R", image_dimensions_df$id_complete4)
image_dimensions_df$id_complete6 <- gsub("-", "_", image_dimensions_df$id_complete5)
split_names <- strsplit(image_dimensions_df$id_complete6, "_")
image_dimensions_df$site <- sapply(split_names, function(x) x[2]) # Second element (T1)
image_dimensions_df$species <- sapply(split_names, function(x) x[3]) # Third element (Ho2)
image_dimensions_df$id_lucas <- sapply(split_names, function(x) x[4]) # Fourth element (03)
image_dimensions_df$organ <- sapply(split_names, function(x) x[5]) # Fifth element (T)
image_dimensions_df$zoom <- sapply(split_names, function(x) x[6]) # Sixth element (X200)
image_dimensions_df$coupe_µm <- sapply(split_names, function(x) x[7]) # Seventh element (09µm)
image_dimensions_df$site_type <- substr(image_dimensions_df$site, 1, 1) # First character (T)
image_dimensions_df$site_replicate <- substr(image_dimensions_df$site, 2, nchar(image_dimensions_df$site)) # Remaining characters (1)
image_dimensions_df$micro <- ifelse(grepl("[a-z]", image_dimensions_df$site_type), 1, 0)
image_dimensions_df$site_type <- toupper(image_dimensions_df$site_type)
image_dimensions_df$species_name <- substr(image_dimensions_df$species, 1, 2) # First two characters (e.g., "Ho")
image_dimensions_df$species_site_replicate <- substr(image_dimensions_df$species, 3, nchar(image_dimensions_df$species)) # Remaining characters (e.g., "1")
image_dimensions_df$width_µm <- image_dimensions_df$width_px / 1.9111
image_dimensions_df$height_µm <- image_dimensions_df$height_px / 1.9111
image_dimensions_df$image_surface_µm2 <- image_dimensions_df$width_µm * image_dimensions_df$height_µm
#####Final dataset####
anat <- data.frame(
file = image_dimensions_df$file,
id_complete = image_dimensions_df$id_complete6,
image_surface_µm2 = image_dimensions_df$image_surface_µm2,
id_amap = image_dimensions_df$id_amap,
number = image_dimensions_df$id_lucas,
site = image_dimensions_df$site,
site_type = image_dimensions_df$site_type,
site_replicate = image_dimensions_df$site_replicate,
species_site_replicate = image_dimensions_df$species,
species = image_dimensions_df$species_name,
species_replicate = image_dimensions_df$species_site_replicate,
micro = image_dimensions_df$micro,
organ = image_dimensions_df$organ,
stringsAsFactors = FALSE
)
vessel <- read.csv(file = "vessel_4.csv", header = T, stringsAsFactors = T)
vessel$file <- vessel$Label
anat <- read.csv(file = "anat_3.csv", header = T, stringsAsFactors = T)
anat$id_amap <- as.character(anat$id_amap)
#Files will change if data is updated
#####Getting proper surface by getting rid of big empty areas####
vessel$id_amap <- as.factor(substr(vessel$file, 1, 4))
#####Clusters####
# clustering function
cluster_vessels <- function(data) {
#Compute radii
data$Radius <- sqrt(data$Area / pi)
data$Radius_enhanced <- data$Radius + 4.5
#distance between every vessel
distances <- as.matrix(dist(data[, c("X", "Y")], method = "euclidean"))
radius_matrix <- outer(data$Radius_enhanced, data$Radius_enhanced, "+")
perimeter_distances <- distances - radius_matrix
data$Cluster <- 0
cluster_id <- 1
#Clustering
repeat {
changes <- FALSE
for (i in seq_len(nrow(perimeter_distances))) {
if (data$Cluster[i] == 0) {
data$Cluster[i] <- cluster_id
nearby <- which(perimeter_distances[i, ] <= 0)
data$Cluster[nearby] <- cluster_id
changes <- TRUE
cluster_id <- cluster_id + 1
}
}
for (i in seq_len(nrow(perimeter_distances) - 1)) {
for (j in seq(i + 1, nrow(perimeter_distances))) {
if (perimeter_distances[i, j] <= 0) {
if (data$Cluster[i] != data$Cluster[j]) {
old_cluster <- data$Cluster[j]
new_cluster <- data$Cluster[i]
data$Cluster[data$Cluster == old_cluster] <- new_cluster
changes <- TRUE
}
}
}
}
if (!changes) break
}
return(data)
}
#Group by `id_amap` and apply clustering
vessel <- vessel %>%
group_by(id_amap) %>%
group_split() %>%
map_dfr(cluster_vessels)
#####Getting rid of extremes####
vessel_mean <- vessel %>%
group_by(id_amap) %>%
summarize(mean = mean(Area))
vessel_extreme <- vessel %>%
filter(Area > 1200)
vessel_extreme_sum <- vessel_extreme %>%
group_by(id_amap) %>%
summarize(sum = sum(Area))
vessel_extreme_sum$id_amap <- as.character(vessel_extreme_sum$id_amap)
anat$id_amap <- as.character(anat$id_amap)
vessel_extreme_sum <- vessel_extreme_sum %>%
full_join(anat, by = "id_amap")
vessel_extreme_sum$sum[is.na(vessel_extreme_sum$sum)] <- 0
vessel_extreme_sum$image_surface_rectified_µm2 <- vessel_extreme_sum$image_surface_µm2 - vessel_extreme_sum$sum
vessel_extreme_sum <- vessel_extreme_sum %>%
dplyr::select(id_amap, image_surface_rectified_µm2)
anat <- anat %>%
left_join(vessel_extreme_sum, by = "id_amap")
#####Calculating mean, standard deviation, sum, count, dh####
#Getting rid of big vessels
vessel_1200 <- vessel %>%
select(id_amap, Area, Perim., Cluster) %>%
filter(Area <= 1200) %>%
mutate(diameter = 2*sqrt(Area/pi),
d4 = diameter^4)
vessel_summary_pre <- vessel_1200 %>%
group_by(id_amap) %>%
distinct(Cluster) %>%
summarize(count_cluster = n())
vessel_summary_pre2 <- vessel_1200 %>%
group_by(id_amap) %>%
summarize(mean_vessel_size_µm2 = mean(Area),
std_dev_vessel_size_µm2 = sd(Area),
mean_vessel_perim_µm = mean(Perim.),
std_dev_perim_µm = sd(Perim.),
sum_vessel_area_µm2 = sum(Area),
dh = (sum(d4)/n())^0.25,
count_vessel = n()
)
vessel_summary <- vessel_summary_pre2 %>%
left_join(vessel_summary_pre, by = "id_amap") %>%
mutate(vessel_grouping = count_vessel / count_cluster)
#####Calculating vessel density and Kth####
vessel_summary <- anat %>%
select(id_amap, image_surface_rectified_µm2) %>%
left_join(vessel_summary, by = "id_amap")
vessel_summary$image_surface_rectified_mm2 <- vessel_summary$image_surface_rectified_µm2 / 1000000
vessel_summary$vessel_density_per_mm2 <- vessel_summary$count_vessel / vessel_summary$image_surface_rectified_mm2
vessel_summary$vessel_density_per_m2 <- vessel_summary$vessel_density_per_mm2 * 10^6
vessel_summary$dh_m <- vessel_summary$dh * 10^-6
vessel_summary$vessel_area <- vessel_summary$sum_vessel_area_µm2 / vessel_summary$image_surface_rectified_µm2
#Getting Kth
water_density <- 998.2
water_viscosity <- 1.002*10^-9
hagen_poiseuille <- (pi * water_density) / (128 * water_viscosity)
vessel_summary$Kth <- hagen_poiseuille * vessel_summary$vessel_density_per_m2 * vessel_summary$dh_m^4
plot(vessel_summary$vessel_density_per_mm2, vessel_summary$Kth)
summary(vessel_summary)
## id_amap image_surface_rectified_µm2 mean_vessel_size_µm2
## Length:158 Min. : 44219 Min. : 77.55
## Class :character 1st Qu.: 136357 1st Qu.:132.53
## Mode :character Median : 213256 Median :170.60
## Mean : 272904 Mean :174.02
## 3rd Qu.: 337876 3rd Qu.:204.73
## Max. :1256749 Max. :405.53
## std_dev_vessel_size_µm2 mean_vessel_perim_µm std_dev_perim_µm
## Min. : 18.18 Min. :37.40 Min. : 7.217
## 1st Qu.: 64.45 1st Qu.:51.09 1st Qu.:14.182
## Median : 93.88 Median :57.24 Median :18.353
## Mean : 96.73 Mean :58.46 Mean :20.001
## 3rd Qu.:120.24 3rd Qu.:63.53 3rd Qu.:23.861
## Max. :243.61 Max. :97.76 Max. :52.718
## sum_vessel_area_µm2 dh count_vessel count_cluster
## Min. : 2481 Min. :10.07 Min. : 23.0 Min. : 17.0
## 1st Qu.: 15981 1st Qu.:13.66 1st Qu.: 86.5 1st Qu.: 57.0
## Median : 26435 Median :15.83 Median : 150.5 Median : 85.0
## Mean : 37240 Mean :15.76 Mean : 227.6 Mean :117.3
## 3rd Qu.: 45270 3rd Qu.:17.49 3rd Qu.: 258.5 3rd Qu.:138.8
## Max. :300059 Max. :24.52 Max. :1716.0 Max. :556.0
## vessel_grouping image_surface_rectified_mm2 vessel_density_per_mm2
## Min. : 1.000 Min. :0.04422 Min. : 165.5
## 1st Qu.: 1.318 1st Qu.:0.13636 1st Qu.: 573.3
## Median : 1.481 Median :0.21326 Median : 706.9
## Mean : 1.991 Mean :0.27290 Mean : 797.8
## 3rd Qu.: 1.968 3rd Qu.:0.33788 3rd Qu.: 960.0
## Max. :15.456 Max. :1.25675 Max. :2371.7
## vessel_density_per_m2 dh_m vessel_area Kth
## Min. :1.655e+08 Min. :1.007e-05 Min. :0.01834 Min. :0.1052
## 1st Qu.:5.733e+08 1st Qu.:1.366e-05 1st Qu.:0.09580 1st Qu.:0.7223
## Median :7.069e+08 Median :1.583e-05 Median :0.12231 Median :1.1344
## Mean :7.978e+08 Mean :1.576e-05 Mean :0.13634 Mean :1.3332
## 3rd Qu.:9.600e+08 3rd Qu.:1.749e-05 3rd Qu.:0.17202 3rd Qu.:1.7190
## Max. :2.372e+09 Max. :2.452e-05 Max. :0.30575 Max. :5.5586
#####
write.csv(vessel_summary, file = "vessel_summary_4.csv")
write.csv(anat, file = "anat_6.csv")
anat <- read.csv(file = "anat_6.csv", header = T, stringsAsFactors = T)
#####Preparing the data####
anat <- anat %>%
select(-X.1, -X)
anat$id_amap <- as.character(anat$id_amap)
vessel_summary$id_amap <- substr(image_dimensions_df$id_complete, 1, 4)
anat <- anat %>%
left_join(vessel_summary, by = "id_amap")
anat$number <- as.factor(anat$number)
anat$count_vessel <- as.numeric(anat$count_vessel)
anat$id_amap <- as.numeric(anat$id_amap)
#####Creating stem and root datasets####
numerical_cols <- c("image_surface_µm2", "image_surface_rectified_µm2.x",
"mean_vessel_size_µm2", "std_dev_vessel_size_µm2", "mean_vessel_perim_µm",
"std_dev_perim_µm", "sum_vessel_area_µm2", "count_vessel", "count_cluster", "vessel_grouping", "dh",
"image_surface_rectified_mm2", "vessel_density_per_mm2", "vessel_density_per_m2",
"dh_m", "vessel_area", "Kth")
anat_Racine <- anat %>%
filter(organ == "R") %>%
dplyr::select(all_of(numerical_cols), number) %>%
rename_with(~ paste0(., "_Racine"), all_of(numerical_cols))
anat_Tige <- anat %>%
filter(organ == "T") %>%
dplyr::select(all_of(numerical_cols), number) %>%
rename_with(~ paste0(., "_Tige"), all_of(numerical_cols))
#####Binding root and stem datasets and selecting variables####
anat_Tige_Racine <- anat_Tige %>%
full_join(anat_Racine, by = "number")
#keeping metadata aside
anat_metadata <- anat %>%
dplyr::select(number, site, site_type, site_replicate, species_site_replicate, species, species_replicate, micro) %>%
distinct(number, site, site_type, site_replicate, species_site_replicate, species, species_replicate, micro)
anat_combined <- anat_metadata %>%
left_join(anat_Tige_Racine, by = "number")
one_ninety <- read.csv("1_90.csv", header = T, stringsAsFactors = T)
anat_combined$number <- as.character(anat_combined$number)
one_ninety$number <- as.character(one_ninety$number)
anat_combined <- anat_combined %>%
full_join(one_ninety, by = "number")
anat_combined$number <- as.integer(anat_combined$number)
#####
write.csv(anat_combined, "anat_combined_3.csv")
archi <- read.csv("archi_2.csv", header =T, stringsAsFactors = T)
anat_combined <- read.csv("anat_combined_3.csv", header = T, stringsAsFactors = T)
metadata <- read.csv("metadata.csv", header = T, stringsAsFactors = T)
#####Joining datasets####
metadata$number <- as.character(metadata$number)
archi$number <- archi$num
anarchi <- archi %>%
dplyr::select(-X, -code, -species, -site_type, -site_replicate, -site, -micro) %>%
full_join(anat_combined, by = "number") %>%
dplyr::select(-X)
anarchi$number <- as.character(anarchi$number)
anarchi <- anarchi %>%
select(-site,-site_type, -site_replicate, -species_site_replicate, -species, -species_replicate, -micro) %>%
left_join(metadata, by = "number")
anarchi <- anarchi %>%
select(-num)
anarchi <- anarchi %>%
select(number, site, site_type, site_replicate, species_site_replicate, species, species_replicate, micro, everything())
#####
write.csv(anarchi, "anarchi_3.csv")
anarchi <- read.csv(file = "anarchi_3.csv", header = T, stringsAsFactors = T)
anarchi_Ho <- anarchi %>%
filter(species == "Ho")
anarchi_Fe <- anarchi %>%
filter(species == "Fe")
anarchi_Ft <- anarchi %>%
filter(species == "Ft")
pairs.panels(anarchi_Fe[,c("Kth_Tige", "vessel_density_per_mm2_Tige", "dh_Tige", "site_type",
"diam_tig_princip_mm", "diam_rac_pivot_mm",
"diam_rac_lat_mm", "diam_tig_lat_mm",
"empreinte_photo_mm", "y_photo_mm")],
method = "spearman", # correlation method
hist.col = "lightgreen",
density = TRUE, # show density plots
ellipses = FALSE # show correlation ellipses
)
pairs.panels(anarchi_Ft[,c("Kth_Tige", "vessel_density_per_mm2_Tige", "dh_Tige", "site_type",
"diam_tig_princip_mm", "diam_rac_pivot_mm",
"diam_rac_lat_mm", "diam_tig_lat_mm",
"empreinte_photo_mm", "y_photo_mm")],
method = "spearman", # correlation method
hist.col = "#00AFBB",
density = TRUE, # show density plots
ellipses = FALSE # show correlation ellipses
)
pairs.panels(anarchi_Ho[,c("Kth_Tige", "vessel_density_per_mm2_Tige", "dh_Tige",
"diam_tig_princip_mm", "diam_rac_pivot_mm",
"diam_rac_lat_mm", "diam_tig_lat_mm",
"empreinte_photo_mm", "y_photo_mm")],
method = "spearman", # correlation method
hist.col = "orange",
density = TRUE, # show density plots
ellipses = FALSE # show correlation ellipses
)
mod_fe_1 <- lm(diam_tig_princip_mm ~ site_type, data = anarchi_Fe)
mod_fe_1_aov <- aov(diam_tig_princip_mm ~ site_type, data = anarchi_Fe)
anova(mod_fe_1)
## Analysis of Variance Table
##
## Response: diam_tig_princip_mm
## Df Sum Sq Mean Sq F value Pr(>F)
## site_type 2 13.467 6.7334 4.6552 0.01656 *
## Residuals 33 47.732 1.4464
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(mod_fe_1)
summary(mod_fe_1)
##
## Call:
## lm(formula = diam_tig_princip_mm ~ site_type, data = anarchi_Fe)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.9367 -0.8617 -0.2639 0.7892 2.6333
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.8133 0.4009 9.512 5.58e-11 ***
## site_typeP -0.1144 0.5669 -0.202 0.8413
## site_typeT 1.1633 0.4910 2.369 0.0238 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.203 on 33 degrees of freedom
## Multiple R-squared: 0.22, Adjusted R-squared: 0.1728
## F-statistic: 4.655 on 2 and 33 DF, p-value: 0.01656
boxplot(diam_tig_princip_mm ~ site_type, data = anarchi_Fe)
tuk_fe_1 <- glht(mod_fe_1_aov, linfct = mcp(site_type = "Tukey"))
# test de Tukey:
summary(tuk_fe_1)
##
## Simultaneous Tests for General Linear Hypotheses
##
## Multiple Comparisons of Means: Tukey Contrasts
##
##
## Fit: aov(formula = diam_tig_princip_mm ~ site_type, data = anarchi_Fe)
##
## Linear Hypotheses:
## Estimate Std. Error t value Pr(>|t|)
## P - F == 0 -0.1144 0.5669 -0.202 0.9777
## T - F == 0 1.1633 0.4910 2.369 0.0596 .
## T - P == 0 1.2778 0.4910 2.602 0.0356 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- single-step method)
tuk.cld_fe_1 <- cld(tuk_fe_1, decreasing = TRUE)
tuk.cld_fe_1 $mcletters$Letters
## F P T
## "ab" "a" "b"
#######
mod_fe_2 <- lm(conicite_mm ~ site_type, data = anarchi_Fe)
mod_fe_2_aov <- aov(conicite_mm ~ site_type, data = anarchi_Fe)
anova(mod_fe_2)
## Analysis of Variance Table
##
## Response: conicite_mm
## Df Sum Sq Mean Sq F value Pr(>F)
## site_type 2 59.3 29.667 0.2603 0.7724
## Residuals 33 3760.9 113.966
plot(mod_fe_2)
#######
mod_fe_3 <- lm(prof_pivot_mm ~ site_type, data = anarchi_Fe)
mod_fe_3_aov <- aov(prof_pivot_mm ~ site_type, data = anarchi_Fe)
anova(mod_fe_3)
## Analysis of Variance Table
##
## Response: prof_pivot_mm
## Df Sum Sq Mean Sq F value Pr(>F)
## site_type 2 18278 9139.1 9.0342 0.000743 ***
## Residuals 33 33383 1011.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(mod_fe_3)
summary(mod_fe_3)
##
## Call:
## lm(formula = prof_pivot_mm ~ site_type, data = anarchi_Fe)
##
## Residuals:
## Min 1Q Median 3Q Max
## -84.111 -19.083 -5.417 11.167 86.167
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 50.000 10.602 4.716 4.25e-05 ***
## site_typeP 49.111 14.993 3.276 0.00248 **
## site_typeT -4.167 12.985 -0.321 0.75032
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 31.81 on 33 degrees of freedom
## Multiple R-squared: 0.3538, Adjusted R-squared: 0.3146
## F-statistic: 9.034 on 2 and 33 DF, p-value: 0.000743
boxplot(prof_pivot_mm ~ site_type, data = anarchi_Fe)
tuk_fe_3 <- glht(mod_fe_3_aov, linfct = mcp(site_type = "Tukey"))
# test de Tukey:
summary(tuk_fe_1)
##
## Simultaneous Tests for General Linear Hypotheses
##
## Multiple Comparisons of Means: Tukey Contrasts
##
##
## Fit: aov(formula = diam_tig_princip_mm ~ site_type, data = anarchi_Fe)
##
## Linear Hypotheses:
## Estimate Std. Error t value Pr(>|t|)
## P - F == 0 -0.1144 0.5669 -0.202 0.9777
## T - F == 0 1.1633 0.4910 2.369 0.0597 .
## T - P == 0 1.2778 0.4910 2.602 0.0355 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- single-step method)
tuk.cld_fe_3 <- cld(tuk_fe_1, decreasing = TRUE)
tuk.cld_fe_3 $mcletters$Letters
## F P T
## "ab" "a" "b"
mod_ft_1 <- lm(diam_tig_princip_mm ~ site_type, data = anarchi_Ft)
mod_ft_1_aov <- aov(diam_tig_princip_mm ~ site_type, data = anarchi_Ft)
anova(mod_ft_1)
## Analysis of Variance Table
##
## Response: diam_tig_princip_mm
## Df Sum Sq Mean Sq F value Pr(>F)
## site_type 2 160.95 80.474 7.7581 0.001731 **
## Residuals 33 342.30 10.373
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(mod_ft_1)
summary(mod_ft_1)
##
## Call:
## lm(formula = diam_tig_princip_mm ~ site_type, data = anarchi_Ft)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.5417 -1.7021 -0.4572 0.6208 13.4383
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.022 1.074 4.678 4.75e-05 ***
## site_typeP 1.334 1.518 0.879 0.385791
## site_typeT 4.789 1.315 3.643 0.000916 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.221 on 33 degrees of freedom
## Multiple R-squared: 0.3198, Adjusted R-squared: 0.2786
## F-statistic: 7.758 on 2 and 33 DF, p-value: 0.001731
boxplot(diam_tig_princip_mm ~ site_type, data = anarchi_Ft)
tuk_ft_1 <- glht(mod_ft_1_aov, linfct = mcp(site_type = "Tukey"))
# test de Tukey:
summary(tuk_fe_1)
##
## Simultaneous Tests for General Linear Hypotheses
##
## Multiple Comparisons of Means: Tukey Contrasts
##
##
## Fit: aov(formula = diam_tig_princip_mm ~ site_type, data = anarchi_Fe)
##
## Linear Hypotheses:
## Estimate Std. Error t value Pr(>|t|)
## P - F == 0 -0.1144 0.5669 -0.202 0.9777
## T - F == 0 1.1633 0.4910 2.369 0.0596 .
## T - P == 0 1.2778 0.4910 2.602 0.0354 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- single-step method)
tuk.cld_ft_1 <- cld(tuk_ft_1, decreasing = TRUE)
tuk.cld_ft_1 $mcletters$Letters
## F P T
## "b" "b" "a"
mod_ft_2 <- lm(conicite_mm ~ site_type, data = anarchi_Ft)
mod_ft_2_aov <- aov(conicite_mm ~ site_type, data = anarchi_Ft)
anova(mod_ft_2)
## Analysis of Variance Table
##
## Response: conicite_mm
## Df Sum Sq Mean Sq F value Pr(>F)
## site_type 2 3034.2 1517.1 7.9347 0.001536 **
## Residuals 33 6309.6 191.2
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(mod_ft_2)
summary(mod_ft_2)
##
## Call:
## lm(formula = conicite_mm ~ site_type, data = anarchi_Ft)
##
## Residuals:
## Min 1Q Median 3Q Max
## -23.556 -5.624 -1.997 6.032 49.444
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 21.8889 4.6092 4.749 3.86e-05 ***
## site_typeP 20.6667 6.5184 3.171 0.00328 **
## site_typeT -0.7833 5.6451 -0.139 0.89048
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 13.83 on 33 degrees of freedom
## Multiple R-squared: 0.3247, Adjusted R-squared: 0.2838
## F-statistic: 7.935 on 2 and 33 DF, p-value: 0.001536
boxplot(conicite_mm ~ site_type, data = anarchi_Ft)
tuk_ft_2 <- glht(mod_ft_2_aov, linfct = mcp(site_type = "Tukey"))
# test de Tukey:
summary(tuk_ft_2)
##
## Simultaneous Tests for General Linear Hypotheses
##
## Multiple Comparisons of Means: Tukey Contrasts
##
##
## Fit: aov(formula = conicite_mm ~ site_type, data = anarchi_Ft)
##
## Linear Hypotheses:
## Estimate Std. Error t value Pr(>|t|)
## P - F == 0 20.6667 6.5184 3.171 0.00883 **
## T - F == 0 -0.7833 5.6451 -0.139 0.98938
## T - P == 0 -21.4500 5.6451 -3.800 0.00165 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- single-step method)
tuk.cld_ft_2 <- cld(tuk_ft_2, decreasing = TRUE)
tuk.cld_ft_2 $mcletters$Letters
## F P T
## "b" "a" "b"
mod_ft_3 <- lm(prof_pivot_mm ~ site_type, data = anarchi_Ft)
mod_ft_3_aov <- aov(prof_pivot_mm ~ site_type, data = anarchi_Ft)
anova(mod_ft_3)
## Analysis of Variance Table
##
## Response: prof_pivot_mm
## Df Sum Sq Mean Sq F value Pr(>F)
## site_type 2 510 254.83 0.1957 0.8232
## Residuals 33 42971 1302.16
plot(mod_ft_3)
summary(mod_ft_3)
##
## Call:
## lm(formula = prof_pivot_mm ~ site_type, data = anarchi_Ft)
##
## Residuals:
## Min 1Q Median 3Q Max
## -32.44 -22.11 -11.44 7.25 121.56
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 43.667 12.028 3.630 0.000948 ***
## site_typeP 10.444 17.011 0.614 0.543434
## site_typeT 3.778 14.732 0.256 0.799206
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 36.09 on 33 degrees of freedom
## Multiple R-squared: 0.01172, Adjusted R-squared: -0.04817
## F-statistic: 0.1957 on 2 and 33 DF, p-value: 0.8232
boxplot(prof_pivot_mm ~ site_type, data = anarchi_Ft)
tuk_ft_3 <- glht(mod_ft_3_aov, linfct = mcp(site_type = "Tukey"))
# test de Tukey:
summary(tuk_fe_1)
##
## Simultaneous Tests for General Linear Hypotheses
##
## Multiple Comparisons of Means: Tukey Contrasts
##
##
## Fit: aov(formula = diam_tig_princip_mm ~ site_type, data = anarchi_Fe)
##
## Linear Hypotheses:
## Estimate Std. Error t value Pr(>|t|)
## P - F == 0 -0.1144 0.5669 -0.202 0.9777
## T - F == 0 1.1633 0.4910 2.369 0.0597 .
## T - P == 0 1.2778 0.4910 2.602 0.0355 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- single-step method)
tuk.cld_ft_3 <- cld(tuk_ft_3, decreasing = TRUE)
tuk.cld_ft_3 $mcletters$Letters
## F P T
## "a" "a" "a"
No site models: Helianthemum was only sampled in T
mod_fe_an_1 <- lm(vessel_density_per_mm2_Tige ~ site_type, data = anarchi_Fe)
mod_fe_an_1_aov <- aov(vessel_density_per_mm2_Tige ~ site_type, data = anarchi_Fe)
anova(mod_fe_an_1)
## Analysis of Variance Table
##
## Response: vessel_density_per_mm2_Tige
## Df Sum Sq Mean Sq F value Pr(>F)
## site_type 2 704 352 0.0026 0.9974
## Residuals 29 3955549 136398
plot(mod_fe_an_1)
summary(mod_fe_an_1)
##
## Call:
## lm(formula = vessel_density_per_mm2_Tige ~ site_type, data = anarchi_Fe)
##
## Residuals:
## Min 1Q Median 3Q Max
## -407.3 -240.5 -102.8 196.4 1070.9
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 800.387 123.107 6.502 4.06e-07 ***
## site_typeP -1.931 174.100 -0.011 0.991
## site_typeT 8.375 157.791 0.053 0.958
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 369.3 on 29 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.0001779, Adjusted R-squared: -0.06878
## F-statistic: 0.00258 on 2 and 29 DF, p-value: 0.9974
boxplot(vessel_density_per_mm2_Tige ~ site_type, data = anarchi_Fe)
tuk_fe_an_1 <- glht(mod_fe_an_1_aov, linfct = mcp(site_type = "Tukey"))
# test de Tukey:
summary(mod_fe_an_1)
##
## Call:
## lm(formula = vessel_density_per_mm2_Tige ~ site_type, data = anarchi_Fe)
##
## Residuals:
## Min 1Q Median 3Q Max
## -407.3 -240.5 -102.8 196.4 1070.9
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 800.387 123.107 6.502 4.06e-07 ***
## site_typeP -1.931 174.100 -0.011 0.991
## site_typeT 8.375 157.791 0.053 0.958
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 369.3 on 29 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.0001779, Adjusted R-squared: -0.06878
## F-statistic: 0.00258 on 2 and 29 DF, p-value: 0.9974
tuk.cld_fe_an_1 <- cld(tuk_fe_an_1, decreasing = TRUE)
tuk.cld_fe_an_1 $mcletters$Letters
## F P T
## "a" "a" "a"
mod_fe_an_2 <- lm(mean_vessel_size_µm2_Tige ~ site_type, data = anarchi_Fe)
mod_fe_an_2_aov <- aov(mean_vessel_size_µm2_Tige ~ site_type, data = anarchi_Fe)
anova(mod_fe_an_2)
## Analysis of Variance Table
##
## Response: mean_vessel_size_µm2_Tige
## Df Sum Sq Mean Sq F value Pr(>F)
## site_type 2 1015 507.58 0.4223 0.6595
## Residuals 29 34856 1201.94
plot(mod_fe_an_2)
summary(mod_fe_an_2)
##
## Call:
## lm(formula = mean_vessel_size_µm2_Tige ~ site_type, data = anarchi_Fe)
##
## Residuals:
## Min 1Q Median 3Q Max
## -56.564 -26.508 -0.612 22.312 64.786
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 174.951 11.556 15.139 2.65e-15 ***
## site_typeP -14.932 16.343 -0.914 0.368
## site_typeT -6.237 14.812 -0.421 0.677
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 34.67 on 29 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.0283, Adjusted R-squared: -0.03871
## F-statistic: 0.4223 on 2 and 29 DF, p-value: 0.6595
boxplot(mean_vessel_size_µm2_Tige ~ site_type, data = anarchi_Fe)
tuk_fe_an_2 <- glht(mod_fe_an_2_aov, linfct = mcp(site_type = "Tukey"))
# test de Tukey:
summary(mod_fe_an_2)
##
## Call:
## lm(formula = mean_vessel_size_µm2_Tige ~ site_type, data = anarchi_Fe)
##
## Residuals:
## Min 1Q Median 3Q Max
## -56.564 -26.508 -0.612 22.312 64.786
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 174.951 11.556 15.139 2.65e-15 ***
## site_typeP -14.932 16.343 -0.914 0.368
## site_typeT -6.237 14.812 -0.421 0.677
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 34.67 on 29 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.0283, Adjusted R-squared: -0.03871
## F-statistic: 0.4223 on 2 and 29 DF, p-value: 0.6595
tuk.cld_fe_an_2 <- cld(tuk_fe_an_2, decreasing = TRUE)
tuk.cld_fe_an_2 $mcletters$Letters
## F P T
## "a" "a" "a"
mod_fe_an_3 <- lm(Kth_Tige ~ site_type, data = anarchi_Fe)
mod_fe_an_3_aov <- aov(Kth_Tige ~ site_type, data = anarchi_Fe)
anova(mod_fe_an_3)
## Analysis of Variance Table
##
## Response: Kth_Tige
## Df Sum Sq Mean Sq F value Pr(>F)
## site_type 2 0.8217 0.41086 1.1924 0.3179
## Residuals 29 9.9923 0.34456
plot(mod_fe_an_3)
summary(mod_fe_an_3)
##
## Call:
## lm(formula = Kth_Tige ~ site_type, data = anarchi_Fe)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.8352 -0.3050 -0.1274 0.2224 1.9445
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.4130 0.1957 7.222 5.96e-08 ***
## site_typeP -0.4251 0.2767 -1.536 0.135
## site_typeT -0.2452 0.2508 -0.978 0.336
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.587 on 29 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.07599, Adjusted R-squared: 0.01226
## F-statistic: 1.192 on 2 and 29 DF, p-value: 0.3179
boxplot(Kth_Tige ~ site_type, data = anarchi_Fe)
tuk_fe_an_3 <- glht(mod_fe_an_3_aov, linfct = mcp(site_type = "Tukey"))
# test de Tukey:
summary(mod_fe_an_3)
##
## Call:
## lm(formula = Kth_Tige ~ site_type, data = anarchi_Fe)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.8352 -0.3050 -0.1274 0.2224 1.9445
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.4130 0.1957 7.222 5.96e-08 ***
## site_typeP -0.4251 0.2767 -1.536 0.135
## site_typeT -0.2452 0.2508 -0.978 0.336
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.587 on 29 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.07599, Adjusted R-squared: 0.01226
## F-statistic: 1.192 on 2 and 29 DF, p-value: 0.3179
tuk.cld_fe_an_3 <- cld(tuk_fe_an_3, decreasing = TRUE)
tuk.cld_fe_an_3 $mcletters$Letters
## F P T
## "a" "a" "a"
mod_ft_an_1 <- lm(vessel_density_per_mm2_Tige ~ site_type, data = anarchi_Ft)
mod_ft_an_1_aov <- aov(vessel_density_per_mm2_Tige ~ site_type, data = anarchi_Ft)
anova(mod_ft_an_1)
## Analysis of Variance Table
##
## Response: vessel_density_per_mm2_Tige
## Df Sum Sq Mean Sq F value Pr(>F)
## site_type 2 162221 81110 1.3489 0.2748
## Residuals 30 1803884 60129
plot(mod_ft_an_1)
summary(mod_ft_an_1)
##
## Call:
## lm(formula = vessel_density_per_mm2_Tige ~ site_type, data = anarchi_Ft)
##
## Residuals:
## Min 1Q Median 3Q Max
## -491.68 -173.21 -60.24 173.92 417.91
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 560.88 81.74 6.862 1.29e-07 ***
## site_typeP 184.06 115.59 1.592 0.122
## site_typeT 126.59 103.39 1.224 0.230
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 245.2 on 30 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.08251, Adjusted R-squared: 0.02134
## F-statistic: 1.349 on 2 and 30 DF, p-value: 0.2748
boxplot(vessel_density_per_mm2_Tige ~ site_type, data = anarchi_Ft)
tuk_ft_an_1 <- glht(mod_ft_an_1_aov, linfct = mcp(site_type = "Tukey"))
# test de Tukey:
summary(mod_ft_an_1)
##
## Call:
## lm(formula = vessel_density_per_mm2_Tige ~ site_type, data = anarchi_Ft)
##
## Residuals:
## Min 1Q Median 3Q Max
## -491.68 -173.21 -60.24 173.92 417.91
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 560.88 81.74 6.862 1.29e-07 ***
## site_typeP 184.06 115.59 1.592 0.122
## site_typeT 126.59 103.39 1.224 0.230
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 245.2 on 30 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.08251, Adjusted R-squared: 0.02134
## F-statistic: 1.349 on 2 and 30 DF, p-value: 0.2748
tuk.cld_ft_an_1 <- cld(tuk_ft_an_1, decreasing = TRUE)
tuk.cld_ft_an_1 $mcletters$Letters
## F P T
## "a" "a" "a"
mod_ft_an_2 <- lm(mean_vessel_size_µm2_Tige ~ site_type, data = anarchi_Ft)
mod_ft_an_2_aov <- aov(mean_vessel_size_µm2_Tige ~ site_type, data = anarchi_Ft)
anova(mod_ft_an_2)
## Analysis of Variance Table
##
## Response: mean_vessel_size_µm2_Tige
## Df Sum Sq Mean Sq F value Pr(>F)
## site_type 2 1628 814.22 0.3866 0.6827
## Residuals 30 63179 2105.96
plot(mod_ft_an_2)
summary(mod_ft_an_2)
##
## Call:
## lm(formula = mean_vessel_size_µm2_Tige ~ site_type, data = anarchi_Ft)
##
## Residuals:
## Min 1Q Median 3Q Max
## -51.478 -22.605 -13.047 -0.235 170.408
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 144.040 15.297 9.416 1.82e-10 ***
## site_typeP -8.434 21.633 -0.390 0.699
## site_typeT 8.429 19.349 0.436 0.666
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 45.89 on 30 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.02513, Adjusted R-squared: -0.03986
## F-statistic: 0.3866 on 2 and 30 DF, p-value: 0.6827
boxplot(mean_vessel_size_µm2_Tige ~ site_type, data = anarchi_Ft)
tuk_ft_an_2 <- glht(mod_ft_an_2_aov, linfct = mcp(site_type = "Tukey"))
# test de Tukey:
summary(mod_ft_an_2)
##
## Call:
## lm(formula = mean_vessel_size_µm2_Tige ~ site_type, data = anarchi_Ft)
##
## Residuals:
## Min 1Q Median 3Q Max
## -51.478 -22.605 -13.047 -0.235 170.408
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 144.040 15.297 9.416 1.82e-10 ***
## site_typeP -8.434 21.633 -0.390 0.699
## site_typeT 8.429 19.349 0.436 0.666
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 45.89 on 30 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.02513, Adjusted R-squared: -0.03986
## F-statistic: 0.3866 on 2 and 30 DF, p-value: 0.6827
tuk.cld_ft_an_2 <- cld(tuk_ft_an_2, decreasing = TRUE)
tuk.cld_ft_an_2 $mcletters$Letters
## F P T
## "a" "a" "a"
mod_ft_an_3 <- lm(Kth_Tige ~ site_type, data = anarchi_Ft)
mod_ft_an_3_aov <- aov(Kth_Tige ~ site_type, data = anarchi_Ft)
anova(mod_ft_an_3)
## Analysis of Variance Table
##
## Response: Kth_Tige
## Df Sum Sq Mean Sq F value Pr(>F)
## site_type 2 0.3969 0.19846 0.3615 0.6996
## Residuals 30 16.4680 0.54893
plot(mod_ft_an_3)
summary(mod_ft_an_3)
##
## Call:
## lm(formula = Kth_Tige ~ site_type, data = anarchi_Ft)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.73477 -0.45729 -0.17289 0.07266 2.32816
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.77717 0.24697 3.147 0.00371 **
## site_typeP -0.09386 0.34926 -0.269 0.78997
## site_typeT 0.16204 0.31239 0.519 0.60778
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7409 on 30 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.02354, Adjusted R-squared: -0.04156
## F-statistic: 0.3615 on 2 and 30 DF, p-value: 0.6996
boxplot(Kth_Tige ~ site_type, data = anarchi_Ft)
tuk_ft_an_3 <- glht(mod_ft_an_3_aov, linfct = mcp(site_type = "Tukey"))
# test de Tukey:
summary(mod_ft_an_3)
##
## Call:
## lm(formula = Kth_Tige ~ site_type, data = anarchi_Ft)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.73477 -0.45729 -0.17289 0.07266 2.32816
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.77717 0.24697 3.147 0.00371 **
## site_typeP -0.09386 0.34926 -0.269 0.78997
## site_typeT 0.16204 0.31239 0.519 0.60778
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7409 on 30 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.02354, Adjusted R-squared: -0.04156
## F-statistic: 0.3615 on 2 and 30 DF, p-value: 0.6996
tuk.cld_ft_an_3 <- cld(tuk_ft_an_3, decreasing = TRUE)
tuk.cld_ft_an_3 $mcletters$Letters
## F P T
## "a" "a" "a"
No site models: Helianthemum was only sampled in T